<template>
  <view style="padding-top: 100rpx; padding: 0 20rpx;">
    <view class="text-area">
      <text>输入值:</text>
      <input type="text" v-model="title" style="color: red;" />
    </view>
    <view class="text-area">
      <text>回传值:</text>
      <input type="text" :value="callBackValue" style="color: yellow;" />
    </view>
    <comA :intent="title" @sendToB="handleAData"></comA>
    <comB :fromA="aToBValue" @callBackFun="callBack"></comB>
  </view>
</template>

<script>
import comA from '../../../../components/ComA.vue'
import ComB from '../../../../components/ComB.vue'
export default {
  components: {
    comA,
    ComB
  },
  data() {
    return {
      title: '',
      callBackValue: '',
      aToBValue: '' 
    }
  },
  methods: {
    handleAData(value) {
      this.aToBValue = value;
    },
    callBack(msg) {
      console.warn("---CompB---sendOutside---" + msg);
      this.callBackValue = msg;
    }
  }
}
</script>

<style>
.text-area {
  display: flex;
  align-items: center;
  margin-bottom: 30rpx;
}
.text-area text {
  margin-right: 20rpx;
}
.text-area input {
  border: 1rpx solid #ccc;
  padding: 10rpx;
  border-radius: 8rpx;
  flex: 1; 
}
</style>